Home / Companies / FusionAuth / Blog / Post Details
Content Deep Dive

Building a CLI app with the Device Code grant and golang

Blog post from FusionAuth

Post Details
Company
Date Published
Author
Matt Gowie
Word Count
2,281
Company Posts That Month
5
Language
English
Hacker News Points
2
Post removed?
No
Summary

The post outlines a detailed guide on how to authenticate a Golang CLI application using FusionAuth's OAuth2 Device Code Grant, particularly useful for devices lacking a user-friendly interface for logging in, such as smart TVs or Raspberry Pi. It begins by setting up the necessary environment, including installing Golang, configuring FusionAuth on a local machine, and creating a FusionAuth application and user. The core of the guide focuses on the implementation of a CLI app called "getgif," which uses commands like `login`, `fetch`, and `logout` to authenticate users, fetch gifs from Giphy, and manage user sessions. The process involves initiating a Device Code grant, displaying a user code for authentication, polling the FusionAuth server, and finally obtaining a JWT Access Token that allows the app to retrieve and save user information. The post concludes by encouraging further exploration of FusionAuth's capabilities and the Golang client library.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.