We have a requirement to call Snapchat APIs from the non-browser application. These APIs use OAuth for authentication with a grant-type authorization code.
This grant type needs a redirect URI to authenticate with an external application and generate a code that can be used to create tokens.
We don’t have a redirect URI as ours is a non-browser application that needs to pull(GET) data from Snapchat.
How do we generate tokens as we don’t have to redirect URI? Is the autoriation_code grant type suitable for non-browser-based applications?
Refer Snapchat API Specifications for token generation:
Your application doesn’t have to be a browser, but it does have to support redirection to use the code grant type. From the specification:
"The authorization code grant type is used to obtain both access
tokens and refresh tokens and is optimized for confidential clients.
Since this is a redirection-based flow, the client must be capable of
interacting with the resource owner’s user-agent (typically a web
browser) and capable of receiving incoming requests (via redirection)
from the authorization server."
Depending on which stack your application is written in, there may be libraries available to support this.