Last active
June 18, 2021 22:18
-
-
Save apurbajnu/941e7e4d9ef83f93aa4103491236841e to your computer and use it in GitHub Desktop.
Upload imgur image process with authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get Access token with client _id ------------ | |
method get | |
https://api.imgur.com/oauth2/authorize?client_id=Your_Client_ID&response_type=token&state=APPLICATION_STATE | |
response get access token and refresh token | |
https://imgur.com/?state=APPLICATION_STATE#access_token=ACCESS_TOKEN&expires_in=315360000&token_type=bearer&refresh_token=REFRESH_TOKEN&account_username=USERNAME&account_id=ACCOUNTID | |
get new access token with refresh token-------- | |
method post | |
https://api.imgur.com/oauth2/token | |
data | |
{ | |
"refresh_token": "REFRESH_TOKEN", | |
"client_id":"CLIENT ID", | |
"client_secret":"CLIENT_SECRET", | |
"grant_type":"refresh_token" | |
} | |
response | |
{ | |
"access_token": "ACCESS_TOKEN", | |
"expires_in": 315360000, | |
"token_type": "bearer", | |
"scope": null, | |
"refresh_token": "REFRESH_TOKEN", | |
"account_id": ACCOUNTID , | |
"account_username": "USERNAME" | |
} | |
upload image ------- | |
headers | |
Authorization:Bearer ACCESS_TOKEN | |
data | |
image: base64 data without "data:image/png;base64/url/binary_file" | |
name:abcd | |
title:holla | |
type:png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment