From 3ea0060fe7d2f8b0f47ae3a0a0a703fa78163efe Mon Sep 17 00:00:00 2001 From: Faiz Ahmed Date: Fri, 24 May 2024 15:25:02 +0530 Subject: [PATCH] feat: documentation for imgur (#977) --- README.md | 1 + docs/config-examples/imgur.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 docs/config-examples/imgur.md diff --git a/README.md b/README.md index bb704826..d0a0b86c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ These providers implement the OAuth2 spec, but are not OpenID providers, which m - [Strava](https://developers.strava.com/docs/authentication) ([Example configuration](./docs/config-examples/strava.md)) - [Spotify](https://developer.spotify.com/documentation/general/guides/authorization-guide/) ([Example configuration](./docs/config-examples/spotify.md)) - [Unsplash](https://unsplash.com/documentation) ([Example configuration](./docs/config-examples/unsplash.md)) +- [Imgur](https://apidocs.imgur.com) ([Example configuration](./docs/config-examples/imgur.md)) ## Why you may want to use this library diff --git a/docs/config-examples/imgur.md b/docs/config-examples/imgur.md new file mode 100644 index 00000000..c6498bb6 --- /dev/null +++ b/docs/config-examples/imgur.md @@ -0,0 +1,24 @@ +# Imgur + +Imgur provides an OAuth 2.0 endpoint for logging in with a Imgur user's credentials. You'll need to first [register your Imgur application here](https://api.imgur.com/oauth2/addclient). See [this comment](https://github.com/FormidableLabs/react-native-app-auth/issues/516#issuecomment-2115465572) for detailed setup guide. + +Please note: + +* Imgur does not provide a OIDC discovery endpoint, so `serviceConfiguration` is used instead. + +```js +// your configuration should look something like this +const config = { + issuer: 'https://api.imgur.com/oauth2/', + clientId: 'abc79a5abcdb30e', // your client id + redirectUrl: encodeURIComponent('com.myapp://oauth/callback'), // must wrap it in encodeURIComponent + scopes: [], + serviceConfiguration: { + authorizationEndpoint: 'https://api.imgur.com/oauth2/authorize', + tokenEndpoint: 'https://api.imgur.com/oauth2/token', + }, +}; + +// Log in to get an authentication token +const authState = await authorize(config); +```