Hi Jose,
It's easier to use a client library for this, which handles a lot of the OAuth 2.0 flow, as well as helps with storing refresh tokens and refreshing access tokens. What programming language are you using?
Cheers,
Sérgio
---
Sérgio Gomes
Developer Relations
Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902